from django.db import models

# Create your models here.

class Users(models.Model):
    '''自定义Users表对应的Model类'''
    id = models.AutoField('id', primary_key=True) # 主键可省略不写
    name = models.CharField('姓名', max_length=255)
    age = models.SmallIntegerField('年龄')
    create_time = models.DateTimeField('创建时间', auto_now_add=True)

    def __str__(self):
        return '%d:%s:%d:%d'%(self.id, self.name, self.age, self.create_time)

    # 自定义对应的表名，默认为app名_model名：myapp_users
    class Meta:
        db_table = 'users'
        verbose_name = '用户'
        verbose_name_plural = verbose_name + '管理'